﻿/*
 请参考 http://keleyi.com/a/bjac/4yiwpvt0.htm
 * 对本例子的说明
 */
using System;
using System.Web;
using Keleyi.KFrame.KText;

namespace KeleyiTestWeb.KText
{
    public partial class ClearHtml : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnClear_Click(object sender, EventArgs e)
        {
            tbOuput.Text = KeleyiHtmlHelper.RemoveHtmlTag(tbInput.Text);
        }

        /// <summary>
        /// http://keleyi.com/a/bjac/stq8ewu7.htm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Error(object sender, EventArgs e)
        {
            Exception ex = Server.GetLastError();
            if (ex is HttpRequestValidationException)
            {
                Response.Write("请您输入合法字符串。");
                Server.ClearError();//如果不ClearError()这个异常会继续传到Application_Error()。
            }
        }
    }
}